var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
    })(t, e);
}, function(t, e) {
    function n() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (n.prototype = e.prototype, 
    new n());
}), a = this && this.__decorate || function(t, e, n, o) {
    var a, i = arguments.length, c = i < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, n) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) c = Reflect.decorate(t, e, n, o); else for (var s = t.length - 1; 0 <= s; s--) (a = t[s]) && (c = (i < 3 ? a(c) : 3 < i ? a(e, n, c) : a(e, n)) || c);
    return 3 < i && c && Object.defineProperty(e, n, c), c;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("Global"), s = e("GameBoxBtn"), c = e("AudioManager"), l = e("GameBoxItem"), d = e("ValueManager"), u = e("GameConfig"), p = e("WebManager"), h = e("UIManager"), f = e("AdManager"), g = cc._decorator, m = g.ccclass, y = g.property, v = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.mask = null, t.bg = null, t.layout = null, t.itemtemp = null, t.btn = null, 
        t.type = 0, t.running = !1, t.status = 0, t;
    }
    return i(t, e), t.prototype.onLoad = function() {
        this.bg.x = cc.winSize.width / 2, this.itemtemp.active = !1;
    }, t.prototype.start = function() {
        this.setType();
    }, t.prototype.setType = function() {
        var t, e = this;
        r.G.isMpCheckChannel || u.GC.isVaild("other") ? this.node.active = !1 : (t = d.default.getInstance().getValue("daoliang" + this.type)) ? (this.updateWithData(t), 
        this.running || this.status || (this.node.active = !1)) : p.default.getInstance().redirectPoll({
            Type: this.type,
            success: function(t) {
                0 == t.data.code && (d.default.getInstance().setValue("daoliang" + e.type, t.data.data), 
                e.updateWithData(t.data.data), e.running || e.status || (e.node.active = !1));
            }
        });
    }, t.prototype.updateWithData = function(t) {
        var o = this, a = 0;
        t.forEach(function(t) {
            var e, n = cc.instantiate(o.itemtemp);
            n.parent = o.layout, n.active = !0, n.getComponent(l.default).setInfo({
                appid: t.appid,
                icon: t.icon,
                path: t.path,
                is_open_code: t.is_open_code,
                qr_code: t.qr_code,
                name: t.name
            }, o.type), a < 10 && 0 < (e = GA.rand(0, 2)) && (n.getComponent(l.default).showInfo(e), 
            a++);
        });
    }, t.prototype.onClickBtn = function() {
        var t, e, n = this;
        GA.isQQ() ? (p.default.getInstance().sentLog("点击首页盒子广告按键"), f.default.getInstance().showAppBoxAd()) : GA.isByteDance() ? (p.default.getInstance().sentLog("点击首页盒子广告按键"), 
        r.G.isIOS ? h.default.getInstance().showToast({
            str: "该功能暂不支持IOS"
        }) : null === (e = null === (t = GA.PA) || void 0 === t ? void 0 : t.showMoreGamesModal) || void 0 === e || e.call(t, {
            appLaunchOptions: u.GC.navigateToMiniProgramAppIdList.map(function(t) {
                return {
                    appId: t
                };
            }),
            success: function() {},
            fail: function() {}
        })) : this.running || (c.default.getInstance().playAudio("按钮2"), this.running = !0, 
        this.status ? (this.mask.active = !1, this.btn.hide(), cc.tween(this.bg).by(.3, {
            position: cc.v3(this.bg.width, 0)
        }).call(function() {
            n.node.active = !1, n.running = !1, n.status = 0;
        }).start()) : (this.node.active = !0, this.mask.active = !0, this.btn.show(), cc.tween(this.bg).by(.3, {
            position: cc.v3(-this.bg.width, 0)
        }).call(function() {
            n.running = !1, n.status = 1;
        }).start()));
    }, a([ y(cc.Node) ], t.prototype, "mask", void 0), a([ y(cc.Node) ], t.prototype, "bg", void 0), 
    a([ y(cc.Node) ], t.prototype, "layout", void 0), a([ y(cc.Node) ], t.prototype, "itemtemp", void 0), 
    a([ y(s.default) ], t.prototype, "btn", void 0), a([ y ], t.prototype, "type", void 0), 
    a([ m ], t);
}(cc.Component);

n.default = v;